#include "final.h"
#include "ui_final.h"
#include<QObject>
#include<QPainter>
final::final(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::final)
{
    QObject::connect(&a,SIGNAL(gameoversignal()),this,SLOT(changeslot()));
    //初始化窗口大小
    setFixedSize(GAME_WIDTH,GAME_HEIGHT);
    //设置窗口标题
    setWindowTitle(GAME_TITLE);
    setWindowIcon(QIcon( GAME_ICON));
}

final::~final()
{
    delete ui;
}
void final::changeslot()
{
    a.close();
    this->show();
}
void final::paintEvent(QPaintEvent *)
{
     over.m_map2.load(MAPPATH1);
    QPainter painter(this);
    painter.drawPixmap(0,over.m_map2_posY , over.m_map2);
    QFont scorefont1("宋体",28,QFont::Bold,true);
    scorefont1.setLetterSpacing(QFont::AbsoluteSpacing,10);
    painter.setFont(scorefont1);
    painter.setPen(Qt::green);
    painter.drawText(100,470,"结束 得分:"+QString::number(a.score));
}
